home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGSCAL
/
TINYPASC.LZH
/
TUDECLS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1986-02-17
|
3KB
|
82 lines
{ TUDECLS -- Declarations for extended grammar system }
type
SYMBOL = string[maxtoklen];
SYMTYPE = (RESERVED, SYMERR, USER, VAR_TYPE, FUNC_TYPE);
SYMTABP = ^symtabtype;
SYMTABTYPE = record
{ structure for <identifier>s and keywords }
NEXT: symtabp;
LEVEL: int;
SYM: symbol;
case SYMT: symtype of
reserved: (TOKVAL: tokrange);
var_type: (VADDR: integer);
{relative to BP}
func_type:
(FADDR: integer; {code location}
PBYTES: integer; {bytes of parameters}
IS_ACTUAL, {TRUE if an actual declaration
has been seen}
IS_SYSTEM {system procedure, demands special
treatment}
: boolean);
end;
SYMTABNAMES = array [symtype] of string9;
const SYM_NAMES: symtabnames = (
'reserved ', 'symerr ', 'user ',
'var_type ', 'func_type'
);
type
SEMTYPE = (OTHER, IDENT, FIXED, STRNG,
ADDOP, SUBOP, MPYOP, DIVOP,
ASSIGNOP, EXPR_LIST, WHILE_DO, STMTLIST,
FUNCALL, IF_THEN_ELSE);
SEMRECP = ^semrec;
SEMREC = record
case SEMT: semtype of { semantic stack structure }
ident: (SYMP: symtabp);
fixed: (NUMVAL: integer);
strng: (STX, {index to string table}
STRNGNUM: int); {unique string code number}
addop, subop, mpyop, divop,
assignop, {LEFT := RIGHT}
expr_list, {LEFT=> first, RIGHT=> rest}
while_do, {while LEFT do RIGHT }
stmtlist, {LEFT=> first, RIGHT=> rest}
{also used for global list of strings GSLIST}
funcall: {LEFT ( RIGHT=> expr_list ) }
(LEFT, RIGHT: semrecp);
if_then_else: {if B1 then S1 else S2}
(B1, S1, S2: semrecp);
end;
SEMTABNAMES = array [semtype] of string7;
const SEM_NAMES : semtabnames = (
'Other ', 'Ident ', 'Fixed ',
'String ',
'+ ', '- ', '* ',
'/ ', ':= ',
'ExprLis', 'WhileDo',
'StmtLis', 'FunCall', 'IfThenE'
);
const
VARSIZE= 2; {bytes in a word}
OPCD_POSITION= 10; {tab position of opcode}
OPND_POSITION= 16; {tab position of operand}
DEFAULT_RFILE= 'CON:';
DEFAULT_SFILE= 'CON:';
var
LABCOUNT: integer; {dummy label number}
TRCOUNT: integer; {trace count}
LLEN: integer; {line length}
MAIN_SYMP: symtabp; {points to procedure MAIN}
NEXT_SNUM, {next string label number}
PLEVEL: integer; {nesting level}
GSLIST: semrecp; {global list of literal strings}
COMMENT: string80; {identifier comments in text}